//package com.ffzl.cloud.ui.activity;
//
//import android.app.Activity;
//import android.content.Context;
//import android.content.Intent;
//import android.os.Bundle;
//import android.os.Vibrator;
//import android.util.Log;
//import android.view.View;
//import android.widget.TextView;
//import android.widget.Toast;
//
//import androidx.appcompat.app.AppCompatActivity;
//import androidx.appcompat.widget.Toolbar;
//
//import com.ffzl.cloud.R;
//import com.ffzl.cloud.app.AppActivity;
//import com.hjq.toast.ToastUtils;
//import com.neusoft.qrcode.core.QRCodeView;
//import com.neusoft.qrcode.core.ScanBoxView;
//import com.neusoft.qrcode.core.ZXingView;
//
//import org.jetbrains.annotations.NotNull;
//import org.jetbrains.annotations.Nullable;
//
//import java.util.HashMap;
//
//import kotlin.Metadata;
//import kotlin.Unit;
//import kotlin.jvm.internal.Intrinsics;
//import okhttp3.Call;
//
//public class ScanActivity extends
//        AppCompatActivity implements QRCodeView.Delegate {
//    private static final String TAG = ScanActivity.class.getSimpleName();
//
//    private HashMap _$_findViewCache;
//
//    public void onCreate(@Nullable Bundle savedInstanceState) {
//        super.onCreate(savedInstanceState);
//        this.setContentView(R.layout.activity_scan);
////        Toolbar var10000 = (Toolbar)this._$_findCachedViewById(id.toolbar);
////        Intrinsics.checkNotNullExpressionValue(var10000, "toolbar");
////        var10000.setTitle((CharSequence)"扫描二维码");
////        View var3 = ((Toolbar)this._$_findCachedViewById(id.toolbar)).getChildAt(0);
////        if (var3 == null) {
////            throw new NullPointerException("null cannot be cast to non-null type android.widget.TextView");
////        } else {
////            TextView textView = (TextView)var3;
////            textView.getLayoutParams().width = -1;
////            textView.setGravity(1);
////        }
//    }
//
//    protected void onStart() {
//        super.onStart();
//        ZXingView var1 = (ZXingView)this.findViewById(R.id.zxingview);
//
//        var1.setDelegate((QRCodeView.Delegate)this);
//        var1.startCamera();
//        var1.startSpotAndShowRect();
//        ScanBoxView var10000 = var1.getScanBoxView();
//        Intrinsics.checkNotNullExpressionValue(var10000, "scanBoxView");
//        var10000.setOnlyDecodeScanBoxArea(true);
//    }
//
//    protected void onStop() {
//        ((ZXingView)this.findViewById(R.id.zxingview)).stopCamera();
//        super.onStop();
//    }
//
//    protected void onDestroy() {
//        ((ZXingView)this.findViewById(R.id.zxingview)).onDestroy();
//        super.onDestroy();
//    }
//
//    private final void vibrate() {
//        Object var10000 = this.getSystemService("vibrator");
//        if (var10000 == null) {
//            throw new NullPointerException("null cannot be cast to non-null type android.os.Vibrator");
//        } else {
//            Vibrator vibrator = (Vibrator)var10000;
//            vibrator.vibrate(200L);
//        }
//    }
//
//    public void onScanQRCodeSuccess(@NotNull String result) {
//        Intrinsics.checkNotNullParameter(result, "result");
//        Log.i(TAG, "result:" + result);
//        this.setTitle((CharSequence)("扫描结果为：" + result));
//        this.vibrate();
//        Intent var2 = new Intent();
//
//
//        var2.putExtra("scanResult", result);
//        Unit var8 = Unit.INSTANCE;
//        this.setIntent(var2);
//        this.setResult(100, this.getIntent());
//        this.finish();
//    }
//
//    public void onCameraAmbientBrightnessChanged(boolean isDark) {
//        ZXingView var10000 = (ZXingView)this.findViewById(R.id.zxingview);
//        Intrinsics.checkNotNullExpressionValue(var10000, "zxingview");
//        ScanBoxView var8 = var10000.getScanBoxView();
//        Intrinsics.checkNotNullExpressionValue(var8, "zxingview.scanBoxView");
//        String tipText = var8.getTipText();
//        String ambientBrightnessTip = "\n环境过暗，请打开闪光灯";
//        if (isDark) {
//            ((ZXingView)this.findViewById(R.id.zxingview)).openFlashlight();
//            Intrinsics.checkNotNullExpressionValue(tipText, "tipText");
//            if (!StringsKt.contains$default((CharSequence)tipText, (CharSequence)ambientBrightnessTip, false, 2, (Object)null)) {
//                var10000 = (ZXingView)this.findViewById(R.id.zxingview);
//                Intrinsics.checkNotNullExpressionValue(var10000, "zxingview");
//                var8 = var10000.getScanBoxView();
//                Intrinsics.checkNotNullExpressionValue(var8, "zxingview.scanBoxView");
//                var8.setTipText(tipText + ambientBrightnessTip);
//            }
//        } else {
//            Intrinsics.checkNotNullExpressionValue(tipText, "tipText");
//            if (StringsKt.contains$default((CharSequence)tipText, (CharSequence)ambientBrightnessTip, false, 2, (Object)null)) {
//                byte var5 = 0;
//                int var6 = StringsKt.indexOf$default((CharSequence)tipText, ambientBrightnessTip, 0, false, 6, (Object)null);
//                boolean var7 = false;
//                String var9 = tipText.substring(var5, var6);
//                Intrinsics.checkNotNullExpressionValue(var9, "(this as java.lang.Strin…ing(startIndex, endIndex)");
//                tipText = var9;
//                var10000 = (ZXingView)this._$_findCachedViewById(id.zxingview);
//                Intrinsics.checkNotNullExpressionValue(var10000, "zxingview");
//                var8 = var10000.getScanBoxView();
//                Intrinsics.checkNotNullExpressionValue(var8, "zxingview.scanBoxView");
//                var8.setTipText(tipText);
//            }
//        }
//
//    }
//
//    public void onScanQRCodeOpenCameraError() {
//        Toast.makeText((Context)this, (CharSequence)"打开相机出错", 0).show();
//    }
//
//    public final void onClick(@NotNull View v) {
//        Intrinsics.checkNotNullParameter(v, "v");
//        switch(v.getId()) {
//            case 1000123:
//                ((ZXingView)this.findViewById(R.id.zxingview)).closeFlashlight();
//                break;
//            case 1000268:
//                ((ZXingView)this.findViewById(R.id.zxingview)).openFlashlight();
//        }
//
//    }
//
//    public View _$_findCachedViewById(int var1) {
//        if (this._$_findViewCache == null) {
//            this._$_findViewCache = new HashMap();
//        }
//
//        View var2 = (View)this._$_findViewCache.get(var1);
//        if (var2 == null) {
//            var2 = this.findViewById(var1);
//            this._$_findViewCache.put(var1, var2);
//        }
//
//        return var2;
//    }
//
//    public void _$_clearFindViewByIdCache() {
//        if (this._$_findViewCache != null) {
//            this._$_findViewCache.clear();
//        }
//
//    }
//
//    public static final class Companion {
//        private Companion() {
//        }
//
//        // $FF: synthetic method
//        public Companion(DefaultConstructorMarker $constructor_marker) {
//            this();
//        }
//    }
//}
////AppActivity implements QRCodeView.Delegate {
////
////    private ZXingView zXingView;
////
////    public static void start(Context context) {
////        Intent intent = new Intent(context, ScanActivity.class);
////        if (!(context instanceof Activity)) {
////            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
////        }
////        context.startActivity(intent);
////    }
////
////    @Override
////    protected int getLayoutId() {
////        return R.layout.activity_scan;
////    }
////
////    @Override
////    protected void initView() {
////        zXingView = findViewById(R.id.zxingview);
////
//////        zxingview.apply {
//////            setDelegate(this@ScanActivity)
//////            startCamera() // 打开后置摄像头开始预览，但是并未开始识别
////////            startCamera(Camera.CameraInfo.CAMERA_FACING_FRONT); // 打开前置摄像头开始预览，但是并未开始识别
//////            startSpotAndShowRect() // 显示扫描框，并开始识别
//////            scanBoxView.isOnlyDecodeScanBoxArea = true // 仅识别扫描框中的码
////////            scanBoxView.isOnlyDecodeScanBoxArea = false; // 识别整个屏幕中的码
//////        }
////        zXingView.setDelegate(this);
////        zXingView.startCamera();
////        zXingView.startSpotAndShowRect();
////    }
////
////    @Override
////    protected void initData() {
////
////
////    }
////
////
////    @Override
////    public void onScanQRCodeSuccess(String result) {
////
////    }
////
////    @Override
////    public void onCameraAmbientBrightnessChanged(boolean isDark) {
////        String tipText = zXingView.getScanBoxView().getTipText();
////        String ambientBrightnessTip = "\n环境过暗，请打开闪光灯";
////        if (isDark) {
////            zXingView.openFlashlight();
////            if (!tipText.contains(ambientBrightnessTip)) {
////
////                zXingView.getScanBoxView().setTipText(tipText + ambientBrightnessTip);
////            }
////        } else {
////            if (tipText.contains(ambientBrightnessTip)) {
////                tipText = tipText.substring(0, tipText.indexOf(ambientBrightnessTip));
////                zXingView.getScanBoxView().setTipText(tipText);
////            }
////        }
////    }
////
////    @Override
////    public void onScanQRCodeOpenCameraError() {
////
////        ToastUtils.show("打开相机出错~");
////    }
////
////
////    @Override
////    public void onStart(Call call) {
////        super.onStart(call);
////    }
////
////    @Override
////    protected void onDestroy() {
////        zXingView.onDestroy();
////        super.onDestroy();
////    }
////
////    @Override
////    protected void onStop() {
////        zXingView.stopCamera();
////        super.onStop();
////    }
////
////
////}